{% extends "layout.html" %}

{% block subtitle %}{{ _('Dashboard') }}{% endblock %}

{% from "snippet/macro.html" import nav, pagination %}

{% block content %}
  <div class="panel panel-default">
    <div class="panel-heading">
      <h3 class="panel-title">{{ _('Sidebar') }}</h3>
    </div>
    <form class="form panel-body" action="" method="post">
      <div class="form-group">
        <textarea class="form-control" rows="3" name="content" placeholder="sidebar html">{{ sidebar or '' }}</textarea>
      </div>
      <button class="btn-success btn">{{ _('Update') }}</button>
    </form>
  </div>

  <div class="panel panel-default">
    <div class="panel-heading">
      <h3 class="panel-title">{{ _('Members') }}</h3>
    </div>
    <div class="panel-body">
      <div class="item-list user-list">
        {% for user in paginator.items %}
          <div class="item">
            <div class="account-group">
              <img src="{{ user.avatar(48) }}" alt="{{ user }}"/>
              <a href="{{ url_for('user.view', username=user.username) }}"><strong>{{ user }}</strong></a>

              <div class="meta">
                <time>{{ user.created.strftime('%Y-%m-%d') }}</time>
                {% if user.city %}
                  <span class="sep">•</span>
                  <a href="{{ url_for('user.city', city=user.city) }}">{{ user.city }}</a>
                {% endif %}
                {% if user.is_staff %}
                  <span class="sep">•</span>
                  <span>staff</span>
                {% endif %}
              </div>
            </div>
            {% if g.user.is_admin %}
              <a class="label label-success" href="{{ url_for('admin.user', uid=user.id) }}">{{ _('Edit') }}</a>
            {% endif %}
          </div>
        {% endfor %}
      </div>
    </div>
    {% if paginator.pages > 1 %}
      <div class="pannel-footer">
        {{ pagination(paginator, url_for('admin.dashboard')) }}
      </div>
    {% endif %}
  </div>
{% endblock %}
